package com.example.udpserver;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetSocketAddress;

public class UdpClient {
  public static void main(String[] args) throws IOException {
      DatagramSocket ds = new DatagramSocket(5555);

      String msg = "你好服务端，我是客户端";

      byte[]bytes =msg.getBytes();
      //打包发送
      for(int i = 0;i<10;i++){
      DatagramPacket dp = new DatagramPacket(bytes,bytes.length,new InetSocketAddress("localhost",8090));

      ds.send(dp);
      }
  }
}
